import Vue from "vue";
import VueRouter from "vue-router";

import HomeView from "../views/HomeView.vue";
import JieShaoView from "../views/JieShaoView.vue";
import SmsxrCom from "../components/jieshao/SmsxrCom.vue";
import TjxrCom from "../components/jieshao/TjxrCom.vue";
import CluserCom from "../components/jieshao/CluserCom.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: { name: "home" },
  },
  {
    path: "/home",
    name: "home",
    components: {
      default: HomeView,
    },
  },
  {
    path: "/jieshao",
    name: "jieshao",
    redirect: { name: "smsxr" },
    components: {
      default: JieShaoView,
    },
    meta: {
      index: 1,
    },
    children: [
      {
        path: "smsxr",
        name: "smsxr",
        components: {
          article: SmsxrCom,
        },
      },
      {
        path: "tjxr",
        name: "tjxr",
        components: {
          article: TjxrCom,
        },
      },
      {
        path: "cluser",
        name: "cluser",
        components: {
          article: CluserCom,
        },
      },
    ],
  },
  {
    path: "/about",
    name: "about",
    components: {
      default: () =>
        import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
    },
    meta: {
      index: 2,
    },
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
